/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utilitarios;

import eloma.classe.SaidaCheques;
import eloma.classe.agenda.AgendaAtividade;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
import tabelamodelcolumnmodel.agenda.AgendaAtividadeTableModel;
import tabelamodelcolumnmodel.cheque.SaidaChequeTableModel;

/**
 *
 * @author icaro
 */
public class MyCellRendererAgenda extends DefaultTableCellRenderer {

    /**
     * Creates a new instance of MyCellRenderer
     */
    public MyCellRendererAgenda() {
        super();
    }

    @Override
    public Component getTableCellRendererComponent(
            javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus,
            int row, int column) {
        JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        TableModel tm = table.getModel();

        AgendaAtividade agenda = ((AgendaAtividadeTableModel) tm).getValoresAgenda(row);

        if (agenda.isSituacao() == true) {
            label.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14));
            label.setForeground(Color.BLACK);
            label.setBackground(Color.GREEN);
        } else {
            label.setFont(new java.awt.Font("Microsoft Sans Serif", 0, 14));
            label.setForeground(Color.WHITE);
            label.setBackground(Color.RED);
        }

        return label;

    }
}
